var express = require('express');
var router = express.Router();
var Typelist = require("../models/typelist");

//获取类型数据
router.get('/', function(req, res, next) {
    // let page = parseInt(req.param("page"));
    // let pageSize = parseInt(req.param("pageSize"));
    // let sort = req.param("sort");
    // let skip = (page-1)*pageSize;
    // let params = {};
    // let goodsModel = Goods.find(params).skip(skip).limit(pageSize);
    //
    // goodsModel.sort({"salePrice" : sort});
    var model = Typelist.find();
    model.exec(function(err,result){
        if(err){
            res.json({
                status:"1",
                msg:err.message
            })
        }else{

            res.json({
                status:"0",
                msg:"",
                result:{
                    count:result.length,
                    list:result
                }
            })
        }
    });
});

module.exports = router;
